<!--
 * @FilePath     : /study_code/jquery/api-position.html
 * @Description  : .position() 返回第一个匹配元素 相对于 带有定位的父元素的 偏移坐标
 * @Date         : 2025-04-21 09:25:46
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-21 09:25:53
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <!-- <link rel="stylesheet" href="" /> -->
    <style>
      .parent {
        position: relative;
      }

      .child {
        position: absolute;
        top: 30px;
        left: 100px;
      }
    </style>
  </head>
  <body>
    <div class="parent">
      父元素
      <div class="child">子元素</div>
    </div>

    <script src="/jquery/dist/jquery.min.js"></script>
    <script>
      $(function () {
        console.log('偏移尺寸', $('.child').position())
        /*
        {
          left: 100,
          top: 30
        }
        */
      })
    </script>
  </body>
</html>
